{% extends "blog.html" %}

{% block description %}
  <meta name="description" content="{% for tag in blog.tags %}{{ tag }}, {% endfor %}{{blog.content|striptags|truncatewords:20}}">
{% endblock %}

{% block head %}
{% endblock %}

{% block content %}
  
  {% comment %}
  {% include "div_blog.html" %}
  <div>
  {% for comment in comments %}
    <div class="BlogBlockType3">
    {{ comment.author }} {{ comment.date.date }} {{ comment.date|time:"H:i" }}
    <div class="text">{{ comment.content|removetags:"script" }}</div>
    </div>
  {% endfor %}
  </div>
  {% endcomment %}  
  
  <table id="forum" cellspacing="1">
    <thead>
      <tr>
        <td class="forum_title" style="width: 20%;">{{lang.author}}</td>
        <td class="forum_title" style="width: 80%; border-right: 1px solid white;">
        <a href="{{config.url_blog}}/{{ blog.key.id }}/">{{ blog.title|escape }}</a>
        </td>
      </tr>
    </thead>
    <tbody>
    
    <tr>
    <td class="forum_body">
    {{ blog.author }}<br>{{ blog.date.date }} {{ blog.date|time:"H:i" }}    
    </td>
    <td class="forum_body">
    {{ blog.content|removetags:"script" }}
    
	  <div class="BlogOperation">
	  <br>
	  {% if blog.auth.edit %}
	  <a class="BlogOperation" href="{{config.url_blog}}/edit/{{ blog.key.id }}/">{{ lang.edit }}</a>
	  {% endif %}
	
	  {% if blog.auth.delete %}
	  <a class="BlogOperation" 
	  {% if blogs %}
	    onclick="$.post('{{config.url_blog}}/delete/{{ blog.key.id }}/', function(data){document.location.reload();});" 
	  {% else %}
	    onclick="$.post('{{config.url_blog}}/delete/{{ blog.key.id }}/', function(data){document.location.replace('{{config.url_blog}}/');});"
	  {% endif %}
	    href="#">{{ lang.delete }}</a>
	  {% endif %}
	
	  </div>
      
    </td>
    </tr>    
    
    {% for comment in comments %}
    <tr>
    <td class="forum_body">
    {{ comment.author }}<br>{{ comment.date.date }} {{ comment.date|time:"H:i" }}    
    </td>
    <td class="forum_body">
    {{ comment.content|removetags:"script" }}
    
    <div class="CommentOperation">
    {% if comment.auth.delete %}
    <br>
    <a class="BlogOperation" 
      onclick="$.post('{{config.url_blog}}/comment/delete/{{ comment.key.id }}/', function(data){document.location.reload();});" 
      href="#">{{ lang.delete }}</a>
    {% endif %}
  
    </div>
    
    </td>
    </tr>
    {% endfor %}
  
    </tbody>
    
  </table>  

  <br>{% include "div_pagination.html" %}
    
  <div>
  {% if auth_comment.add %}
  <form action="{{config.url_blog}}/comment/{{ blog.key.id }}/" method="post">
    <div>
    <label for="commentdata">{{lang.forum_reply}}:</label><br>
    <textarea id="wysiwyg" class="bloginput" name="commentdata" rows="12"></textarea>
    </div>
    <div>
    <input type="submit" value="{{ lang.add }}">
    </div>
  </form>
  {% endif %}
  </div>
  
{% endblock %}